package chapter5;
import java.util.Scanner;
/****************************************************************
 * Author：icynlau
 * Description:  计算最大公约数
 * Date:2021/4/3
 * ***************************************************************
 */
public class exc5_14 {
	public static void main(String[] args) {
		Scanner input=new Scanner(System.in);
		System.out.print("Enter two integers:  ");
		int n1=input.nextInt();
		int n2=input.nextInt();
		int d=(n1>n2)?n2:n1;
		for(;d>=1;d--) {
			if(n1%d==0&&n2%d==0) {
				System.out.print("gcd of "+n1+" and "+n2+" is "+d);
				break;
			}
			
		}
		
	}

}
